layui.use('element', function(){
    var element = layui.element;
});

function getHitokoto() {
    fetch('https://v1.hitokoto.cn/?encode=json', {
        method: 'get'
    }).then(res => {
        return res.json()
    }).then(res => {
        $('#hitokoto_text')[0].innerText = res.hitokoto
        $('#hitokoto_author')[0].innerText = `—— ${res.from}`
    })
}
getHitokoto()
setInterval(getHitokoto, 10000)